FLASHING FIRST FRAME TO SET COLLISION
set first frame to full grown frame then start from frame 2 onwards in growth\

function Create(self)
   self.animTimer = Timer()
   
   self.frameChangeTime = 0 -- This is the time interval between changing frames (In miliseconds).
   
   self.Flashframe = 1
   self.startFrame = 2
   self.maxFrame = 12 -- This is the frame at which you want the animation to stop at.
   
   if self.Frame == self.Flashframe then
      self.Frame = self.startFrame
   end 
end

function Update(self)
   if self.Frame == self.startFrame then
	  self.frameChangeTime = 1500
   end 

   if self.Frame >= self.maxFrame then
      self.Frame = self.maxFrame
   else
      if self.animTimer:IsPastSimMS(self.frameChangeTime) then
         self.Frame = self.Frame + 1
         self.animTimer:Reset()
      end
   end
end


ANIMATING IN ONE DIRECTION THEN IN ANOTHER ONCE YOU GET TO TARGET (could be used to animate stuff flying one way or another?)
function Create(self)
   self.FrameTimer = Timer();
   self.FrameInterval = 250;
   self.FrameTimer:Reset();
   self.Frame = 0;
   self.FrameDirection = 0;
end
function Update(self)
   if self.Frame == 0 then
      self.FrameDirection = 0;
   elseif self.Frame == 7 then
      self.FrameDirection = 1;
   end
   if self.FrameTimer:IsPastSimMS(self.FrameInterval) then
      if self.FrameDirection == 0 and self.Frame < 8 then
         self.Frame = self.Frame + 1;
      elseif self.FrameDirection == 1 and self.Frame > 0  then
         self.Frame = self.Frame - 1;
      end
      self.FrameTimer:Reset()
   end
end
function Destroy(self)
end

ADDING GIBS WHEN STUFF DIES

function Destroy(self)
  local particle = CreateMOSRotating("blah")
  particle.Pos = self.Pos
  particle.Vel = self.Vel
  MovableMan:AddParticle(particle)
end

ATTACHABLE STUFF (What this does is that it finds AEmitters that are attached it when it is created, and then changes their frame according to the scripted object's velocity. Also, be sure to change the SpriteAnimMode so the emitters can't animate on their own and allow the script to do it.)
function Create(self)
   self.makeframe = 0;
   self.emitterlist = {};

   for i = 1,MovableMan:GetMOIDCount()-1 do
      attachable = MovableMan:GetMOFromID(i);
    if attachable.PresetName == "AEmitter Name" and attachable.ClassName == "AEmitter" and attachable.RootID == self.RootID then
   self.emitterlist[#self.emitterlist+1] = attachable;
    end
   end

end

function Update(self)

   if self.Vel.Magnitude < 10 then
   self.makeframe = 0;
   elseif self.Vel.Magnitude => 10 and self.Vel.Magnitude < 20 then
   self.makeframe = 1;
   end

   for i = 1, #self.emitterlist do
    if self.emitterlist[i].ID ~= 255 then
   self.emitterlist[i].Frame = self.makeframe;
    end
   end

end
